# coding = utf-8

'''
小波变换的测试
'''

import os
import pywt
import numpy as np
import matplotlib.pyplot as plt

def walvet_test():
    file_path = "/datasets/DongbeiDaxue/chengkunv2/case_00000/imaging"
    for item in sorted(os.listdir(file_path)):
        file_name = os.path.join(file_path, item)
        data = np.load(file_name)
        [cA3, (cD3, cD2, cD1)] = pywt.dwt2(data, wavelet='db1')
        print(data.shape, cA3.shape, cD3.shape, cD2.shape, cD1.shape)
        plt.subplot(1, 5, 1)
        plt.imshow(data, cmap="gray")
        plt.subplot(1, 5, 2)
        plt.imshow(cA3, cmap="gray")
        plt.subplot(1, 5, 3)
        plt.imshow(cD1, cmap="gray")
        plt.subplot(1, 5, 4)
        plt.imshow(cD2, cmap="gray")
        plt.subplot(1, 5, 5)
        plt.imshow(cD3, cmap="gray")
        plt.show()




if __name__ == '__main__':
    walvet_test()